<template>
  <div class="app-container">
    <el-tabs type="border-card" @tab-click="clearQuery">
      <el-tab-pane label="审核管理">
        <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
        >
          <el-form-item label="培训选择" prop="trainName">
            <!-- <el-input
              v-model="queryParams.trainName"
              placeholder="请输入培训名"
              clearable
              @keyup.enter.native="handleQuery"
            /> -->
            <el-select
              v-model="queryParams.trainId"
              placeholder="请选择"
              clearable
              @keyup.enter.native="handleQuery2"
            >
              <el-option
                v-for="item in trainList"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>

          <!-- <el-form-item label="项目Id" prop="projectId">
            <el-input
              v-model="queryParams.projectId"
              placeholder="请输入项目Id"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="项目名" prop="projectName">
            <el-input
              v-model="queryParams.projectName"
              placeholder="请输入项目名"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item> -->
          <el-form-item label="报名人" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="请输入报名人"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="报名电话" prop="tel">
            <el-input
              v-model="queryParams.tel"
              placeholder="请输入报名电话"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="报名身份证" prop="idCard">
            <el-input
              v-model="queryParams.idCard"
              placeholder="请输入报名身份证"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <!-- <el-form-item label="报名单位" prop="unit">
        <el-input
          v-model="queryParams.unit"
          placeholder="请输入报名单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
          <!-- <el-form-item label="报名时间" prop="joinTime">
        <el-date-picker
          clearable
          v-model="queryParams.joinTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择报名时间"
        >
        </el-date-picker>
      </el-form-item> -->

          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
          <!-- <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['project:join:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['project:join:edit']"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['project:join:remove']"
              >删除</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['project:join:export']"
              >导出</el-button
            >
          </el-col> -->
          <right-toolbar
            :showSearch.sync="showSearch"
            @queryTable="getList"
          ></right-toolbar>
        </el-row>

        <el-table
          v-loading="loading2"
          :data="shenheList"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="id" align="center" prop="id" />
          <!-- <el-table-column label="${comment}" align="center" prop="title" /> -->
          <!-- <el-table-column label="培训ID" align="center" prop="trainId" /> -->
          <el-table-column label="培训名" align="center" prop="trainName" />
          <!-- <el-table-column label="xi" align="center" prop="projectId" /> -->
          <el-table-column label="项目名称" align="center" prop="projectName" />
          <el-table-column label="报名人" align="center" prop="name" />
          <el-table-column label="报名电话" align="center" prop="tel" />
          <el-table-column label="报名身份证" align="center" prop="idCard" />
          <el-table-column label="报名单位" align="center" prop="unit" />
          <el-table-column
            label="报名时间"
            align="center"
            prop="joinTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.joinTime) }}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="单间 || 标间" align="center" prop="roomType" />
      <el-table-column label="${comment}" align="center" prop="entryCost" />
      <el-table-column label="总费用" align="center" prop="cost" />
      <el-table-column label="${comment}" align="center" prop="invoiceTitle" />
      <el-table-column
        label="${comment}"
        align="center"
        prop="invoiceTaxNumber"
      />
      <el-table-column label="${comment}" align="center" prop="invoiceTel" />
      <el-table-column label="${comment}" align="center" prop="invoiceBank" />
      <el-table-column
        label="${comment}"
        align="center"
        prop="invoiceBankAddress"
      />
      <el-table-column label="收件人" align="center" prop="mailPerson" />
      <el-table-column label="收件人电话" align="center" prop="mailTel" />
      <el-table-column label="收件地址" align="center" prop="mailAddress" /> -->
          <el-table-column label="报名状态" align="center" prop="status">
            <template slot-scope="scope">
              <el-popover trigger="hover" placement="top">
                <div slot="reference" class="name-wrapper">
                  <el-tag
                    v-show="scope.row.status === '已退回'"
                    size="medium"
                    type="danger"
                    >{{ scope.row.status }}</el-tag
                  >

                  <el-tag
                    v-show="scope.row.status === '待审核'"
                    size="medium"
                    type="warning"
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '已通过'"
                    size="medium"
                    type="success"
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '待缴费'"
                    size="medium"
                    type=""
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '草稿'"
                    size="medium"
                    type="info"
                    >{{ scope.row.status }}</el-tag
                  >
                </div>
              </el-popover>
            </template>
          </el-table-column>
          <!-- <el-table-column label="${comment}" align="center" prop="rejectCause" />
      <el-table-column label="创建人" align="center" prop="createBy" /> -->
          <el-table-column
            label="创建时间"
            align="center"
            prop="createTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="修改人" align="center" prop="updateBy" />
      <el-table-column
        label="修改时间"
        align="center"
        prop="updateTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="排序字段" align="center" prop="sort" /> -->
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="shenhe(scope.row)"
                v-hasPermi="['project:join:edit']"
                >审核</el-button
              >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete2(scope.row)"
                v-hasPermi="['project:join:remove']"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total2 > 0"
          :total="total2"
          :page.sync="queryParams.page"
          :limit.sync="queryParams.rowsPerPage"
          @pagination="getList"
        />

        <!-- 添加或修改培训报名对话框 -->
        <el-dialog
          :close-on-click-modal="false"
          :title="title"
          :visible.sync="open2"
          width="1000px"
          append-to-body
          class="scrollbar"
        >
          <el-scrollbar style="height: 100%">
            <el-form
              ref="form2"
              :model="form2"
              :rules="rules"
              label-width="100px"
            >
              <el-row>
                <el-col :span="10">
                  <el-form-item label="报名人" prop="name">
                    <el-input v-model="form2.name" placeholder="请输入报名人" />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="报名电话" prop="tel">
                    <el-input
                      v-model="form2.tel"
                      placeholder="请输入报名电话"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="报名身份证" prop="idCard">
                    <el-input
                      v-model="form2.idCard"
                      placeholder="请输入报名身份证"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="报名单位" prop="unit">
                    <el-input
                      v-model="form2.unit"
                      placeholder="请输入报名单位"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <!-- <el-form-item label="报名标题" prop="title">
              <el-input v-model="form.title" placeholder="请输入报名标题" />
            </el-form-item> -->
              <!-- <el-form-item label="培训ID" prop="trainId">
              <el-input v-model="form.trainId" placeholder="请输入培训ID" />
            </el-form-item>
            <el-form-item label="培训名" prop="trainName">
              <el-input v-model="form.trainName" placeholder="请输入培训名" />
            </el-form-item> -->
              <!-- <el-form-item label="${comment}" prop="projectId">
              <el-input
                v-model="form.projectId"
                placeholder="请输入${comment}"
              />
            </el-form-item> -->
              <!-- <el-form-item label="${comment}" prop="projectName">
              <el-input
                v-model="form.projectName"
                placeholder="请输入${comment}"
              />
            </el-form-item> -->

              <el-form-item label="报名时间" prop="joinTime">
                <el-date-picker
                  clearable
                  v-model="form2.joinTime"
                  type="date"
                  value-format="yyyy-MM-dd"
                  placeholder="请选择报名时间"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item label="报名状态" prop="status">
                <el-radio-group v-model="form2.status">
                  <el-radio-button label="草稿"></el-radio-button>
                  <el-radio-button label="待缴费"></el-radio-button>
                  <el-radio-button label="待审核"></el-radio-button>
                  <el-radio-button label="已退回"></el-radio-button>
                  <el-radio-button label="已通过"></el-radio-button>
                </el-radio-group>
              </el-form-item>
              <!-- <el-form-item label="${comment}" prop="entryCost">
              <el-input
                v-model="form.entryCost"
                placeholder="请输入${comment}"
              />
            </el-form-item> -->
              <el-form-item label="总费用" prop="cost">
                <el-input v-model="form2.cost" placeholder="请输入总费用" />
              </el-form-item>
              <el-divider>报名项目</el-divider>

              <el-form-item label="培训名" prop="trainName">
                <el-input
                  v-model="form2.trainName"
                  placeholder="请输入培训名"
                />
              </el-form-item>

              <el-form-item label="项目名称" prop="projectName">
                <el-input
                  v-model="form2.projectName"
                  placeholder="请输入培训名称"
                />
              </el-form-item>
              <el-divider>发票信息</el-divider>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="单位名称" prop="invoiceTitle">
                    <el-input
                      v-model="form2.invoiceTitle"
                      placeholder="请输入单位名称"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="发票税号" prop="invoiceTaxNumber">
                    <el-input
                      v-model="form2.invoiceTaxNumber"
                      placeholder="请输入发票税号"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="电话" prop="invoiceTel">
                    <el-input
                      v-model="form2.invoiceTel"
                      placeholder="请输入电话"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="开户账号" prop="invoiceBank">
                    <el-input
                      v-model="form2.invoiceBank"
                      placeholder="请输入开户账号"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="发票接收地址" prop="invoiceBankAddress">
                    <el-input
                      v-model="form2.invoiceBankAddress"
                      placeholder="请输入发票接收地址"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item> </el-form-item>
                </el-col>
              </el-row>
              <el-divider>邮寄信息</el-divider>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="收件人" prop="mailPerson">
                    <el-input
                      v-model="form2.mailPerson"
                      placeholder="请输入收件人"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="收件人电话" prop="mailTel">
                    <el-input
                      v-model="form2.mailTel"
                      placeholder="请输入收件人电话"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="收件地址" prop="mailAddress">
                    <el-input
                      v-model="form2.mailAddress"
                      placeholder="请输入收件地址"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="14">
                  <el-form-item> </el-form-item>
                </el-col>
              </el-row>
              <!-- <el-form-item label="${comment}" prop="rejectCause">
              <el-input
                v-model="form2.rejectCause"
                placeholder="请输入${comment}"
              />
            </el-form-item> -->
              <!-- <el-form-item label="排序字段" prop="sort">
              <el-input v-model="form2.sort" placeholder="请输入排序字段" />
            </el-form-item> -->
              <el-divider>审核信息</el-divider>
              <el-form-item label="报名状态" prop="status">
                <el-popover trigger="hover" placement="top">
                  <div slot="reference" class="name-wrapper">
                    <el-tag
                      v-show="form2.status === '已退回'"
                      size="medium"
                      type="danger"
                      >{{ form2.status }}</el-tag
                    >

                    <el-tag
                      v-show="form2.status === '待审核'"
                      size="medium"
                      type="warning"
                      >{{ form2.status }}</el-tag
                    >
                    <el-tag
                      v-show="form2.status === '已通过'"
                      size="medium"
                      type="success"
                      >{{ form2.status }}</el-tag
                    >
                    <el-tag
                      v-show="form2.status === '待缴费'"
                      size="medium"
                      type=""
                      >{{ form2.status }}</el-tag
                    >
                    <el-tag
                      v-show="form2.status === '草稿'"
                      size="medium"
                      type="info"
                      >{{ form2.status }}</el-tag
                    >
                  </div>
                </el-popover>
              </el-form-item>
              <el-form-item label="审核" prop="status">
                <el-button
                  type="success"
                  :disabled="form2.status === '已通过'"
                  @click="submitYes"
                  >审核通过</el-button
                >
                <el-button
                  type="danger"
                  :disabled="form2.status === '已退回'"
                  @click="submitNo"
                  >退回</el-button
                >
              </el-form-item>
              <el-form-item label="审核失败退回原因">
                <el-input
                  v-model="submitForm.rejectCause"
                  placeholder="请输入审核失败原因"
                />
              </el-form-item>
            </el-form>
          </el-scrollbar>
          <div slot="footer" class="dialog-footer">
            <!-- <el-button type="primary" @click="submitForm">确 定</el-button> -->
            <el-button @click="cancel2">取 消</el-button>
          </div>
        </el-dialog></el-tab-pane
      >
      <el-tab-pane label="报名管理">
        <el-form
          :model="queryParams"
          ref="queryForm2"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
        >
          <el-form-item label="培训选择" prop="trainName">
            <!-- <el-input
              v-model="queryParams.trainName"
              placeholder="请输入培训名"
              clearable
              @keyup.enter.native="handleQuery"
            /> -->
            <el-select
              v-model="queryParams.trainId"
              placeholder="请选择"
              clearable
              @keyup.enter.native="handleQuery2"
            >
              <el-option
                v-for="item in trainList"
                :key="item.id"
                :label="item.name"
                :value="item.id"
              >
              </el-option>
            </el-select>
          </el-form-item>

          <!-- <el-form-item label="项目Id" prop="projectId">
            <el-input
              v-model="queryParams.projectId"
              placeholder="请输入项目Id"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="项目名" prop="projectName">
            <el-input
              v-model="queryParams.projectName"
              placeholder="请输入项目名"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item> -->
          <el-form-item label="报名人" prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="请输入报名人"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="报名电话" prop="tel">
            <el-input
              v-model="queryParams.tel"
              placeholder="请输入报名电话"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <el-form-item label="报名身份证" prop="idCard">
            <el-input
              v-model="queryParams.idCard"
              placeholder="请输入报名身份证"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
          <!-- <el-form-item label="报名单位" prop="unit">
        <el-input
          v-model="queryParams.unit"
          placeholder="请输入报名单位"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
          <!-- <el-form-item label="报名时间" prop="joinTime">
        <el-date-picker
          clearable
          v-model="queryParams.joinTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择报名时间"
        >
        </el-date-picker>
      </el-form-item> -->

          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>

        <el-row :gutter="10" class="mb8">
          <!-- <el-col :span="1.5">
            <el-button
              type="primary"
              plain
              icon="el-icon-plus"
              size="mini"
              @click="handleAdd"
              v-hasPermi="['project:join:add']"
              >新增</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="success"
              plain
              icon="el-icon-edit"
              size="mini"
              :disabled="single"
              @click="handleUpdate"
              v-hasPermi="['project:join:edit']"
              >修改</el-button
            >
          </el-col>
          <el-col :span="1.5">
            <el-button
              type="danger"
              plain
              icon="el-icon-delete"
              size="mini"
              :disabled="multiple"
              @click="handleDelete"
              v-hasPermi="['project:join:remove']"
              >删除</el-button
            >
            
          <el-col :span="1.5">
            <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              @click="handleExport"
              v-hasPermi="['project:join:export']"
              >导出</el-button
            >
          </el-col> -->
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportTotal"
              >本省培训人员汇总表导出</el-button
            >
          </el-col>
          <!-- <el-col :span="1.5">
              <el-button plain icon="el-icon-download" @click="exportCost"
                >导出本省联系人表导出</el-button
              >
            </el-col> -->
          <el-col :span="1.5">
            <el-button plain icon="el-icon-download" @click="exportReffers"
              >费用表导出</el-button
            >
          </el-col>
          <!-- <el-col :span="1.5">
              <el-button plain icon="el-icon-download" @click="exportReffers"
                >单位表导出</el-button
              >
            </el-col> -->

          <right-toolbar
            :showSearch.sync="showSearch"
            @queryTable="getList"
          ></right-toolbar>
        </el-row>

        <el-table
          v-loading="loading"
          :data="joinList"
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column label="id" align="center" prop="id" />
          <!-- <el-table-column label="${comment}" align="center" prop="title" /> -->
          <!-- <el-table-column label="培训ID" align="center" prop="trainId" /> -->
          <el-table-column label="培训名" align="center" prop="trainName" />
          <!-- <el-table-column label="xi" align="center" prop="projectId" /> -->
          <el-table-column label="项目名称" align="center" prop="projectName" />
          <el-table-column label="报名人" align="center" prop="name" />
          <el-table-column label="报名电话" align="center" prop="tel" />
          <el-table-column label="报名身份证" align="center" prop="idCard" />
          <el-table-column label="报名单位" align="center" prop="unit" />
          <el-table-column
            label="报名时间"
            align="center"
            prop="joinTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.joinTime, "{y}-{m}-{d}") }}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="单间 || 标间" align="center" prop="roomType" />
      <el-table-column label="${comment}" align="center" prop="entryCost" />
      <el-table-column label="总费用" align="center" prop="cost" />
      <el-table-column label="${comment}" align="center" prop="invoiceTitle" />
      <el-table-column
        label="${comment}"
        align="center"
        prop="invoiceTaxNumber"
      />
      <el-table-column label="${comment}" align="center" prop="invoiceTel" />
      <el-table-column label="${comment}" align="center" prop="invoiceBank" />
      <el-table-column
        label="${comment}"
        align="center"
        prop="invoiceBankAddress"
      />
      <el-table-column label="收件人" align="center" prop="mailPerson" />
      <el-table-column label="收件人电话" align="center" prop="mailTel" />
      <el-table-column label="收件地址" align="center" prop="mailAddress" /> -->
          <el-table-column label="报名状态" align="center" prop="status">
            <template slot-scope="scope">
              <el-popover trigger="hover" placement="top">
                <div slot="reference" class="name-wrapper">
                  <el-tag
                    v-show="scope.row.status === '已退回'"
                    size="medium"
                    type="danger"
                    >{{ scope.row.status }}</el-tag
                  >

                  <el-tag
                    v-show="scope.row.status === '待审核'"
                    size="medium"
                    type="warning"
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '已通过'"
                    size="medium"
                    type="success"
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '待缴费'"
                    size="medium"
                    type=""
                    >{{ scope.row.status }}</el-tag
                  >
                  <el-tag
                    v-show="scope.row.status === '草稿'"
                    size="medium"
                    type="info"
                    >{{ scope.row.status }}</el-tag
                  >
                </div>
              </el-popover>
            </template>
          </el-table-column>
          <!-- <el-table-column label="${comment}" align="center" prop="rejectCause" />
      <el-table-column label="创建人" align="center" prop="createBy" /> -->
          <el-table-column
            label="创建时间"
            align="center"
            prop="createTime"
            width="180"
          >
            <template slot-scope="scope">
              <span>{{ parseTime(scope.row.createTime) }}</span>
            </template>
          </el-table-column>
          <!-- <el-table-column label="修改人" align="center" prop="updateBy" />
      <el-table-column
        label="修改时间"
        align="center"
        prop="updateTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="排序字段" align="center" prop="sort" /> -->
          <el-table-column
            label="操作"
            align="center"
            class-name="small-padding fixed-width"
          >
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="text"
                icon="el-icon-edit"
                @click="handleUpdate(scope.row)"
                v-hasPermi="['project:join:edit']"
                >修改</el-button
              >
              <el-button
                size="mini"
                type="text"
                icon="el-icon-delete"
                @click="handleDelete(scope.row)"
                v-hasPermi="['project:join:remove']"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>

        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.page"
          :limit.sync="queryParams.rowsPerPage"
          @pagination="getList"
        />

        <!-- 添加或修改培训报名对话框 -->
        <el-dialog
          :close-on-click-modal="false"
          :title="title"
          :visible.sync="open"
          width="1000px"
          append-to-body
          class="scrollbar"
        >
          <el-scrollbar style="height: 100%">
            <el-form
              ref="form"
              :model="form"
              :rules="rules"
              label-width="100px"
            >
              <el-row>
                <el-col :span="10">
                  <el-form-item label="报名人" prop="name">
                    <el-input v-model="form.name" placeholder="请输入报名人" />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="报名电话" prop="tel">
                    <el-input v-model="form.tel" placeholder="请输入报名电话" />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="报名身份证" prop="idCard">
                    <el-input
                      v-model="form.idCard"
                      placeholder="请输入报名身份证"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="报名单位" prop="unit">
                    <el-input
                      v-model="form.unit"
                      placeholder="请输入报名单位"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <!-- <el-form-item label="报名标题" prop="title">
              <el-input v-model="form.title" placeholder="请输入报名标题" />
            </el-form-item> -->
              <!-- <el-form-item label="培训ID" prop="trainId">
              <el-input v-model="form.trainId" placeholder="请输入培训ID" />
            </el-form-item>
            <el-form-item label="培训名" prop="trainName">
              <el-input v-model="form.trainName" placeholder="请输入培训名" />
            </el-form-item> -->
              <!-- <el-form-item label="${comment}" prop="projectId">
              <el-input
                v-model="form.projectId"
                placeholder="请输入${comment}"
              />
            </el-form-item> -->
              <!-- <el-form-item label="${comment}" prop="projectName">
              <el-input
                v-model="form.projectName"
                placeholder="请输入${comment}"
              />
            </el-form-item> -->

              <el-form-item label="报名时间" prop="joinTime">
                <el-date-picker
                  clearable
                  v-model="form.joinTime"
                  type="date"
                  value-format="yyyy-MM-dd"
                  placeholder="请选择报名时间"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item label="报名状态" prop="status">
                <el-radio-group v-model="form.status">
                  <el-radio-button label="草稿"></el-radio-button>
                  <el-radio-button label="待缴费"></el-radio-button>
                  <el-radio-button label="待审核"></el-radio-button>
                  <el-radio-button label="已退回"></el-radio-button>
                  <el-radio-button label="已通过"></el-radio-button>
                </el-radio-group>
              </el-form-item>
              <!-- <el-form-item label="${comment}" prop="entryCost">
              <el-input
                v-model="form.entryCost"
                placeholder="请输入${comment}"
              />
            </el-form-item> -->
              <el-form-item label="总费用" prop="cost">
                <el-input v-model="form.cost" placeholder="请输入总费用" />
              </el-form-item>
              <el-divider>报名项目</el-divider>

              <el-form-item label="培训名" prop="trainName">
                <el-input v-model="form.trainName" placeholder="请输入培训名" />
              </el-form-item>

              <el-form-item label="项目名称" prop="projectName">
                <el-input
                  v-model="form.projectName"
                  placeholder="请输入培训名称"
                />
              </el-form-item>
              <el-divider>发票信息</el-divider>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="单位名称" prop="invoiceTitle">
                    <el-input
                      v-model="form.invoiceTitle"
                      placeholder="请输入单位名称"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="发票税号" prop="invoiceTaxNumber">
                    <el-input
                      v-model="form.invoiceTaxNumber"
                      placeholder="请输入发票税号"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="电话" prop="invoiceTel">
                    <el-input
                      v-model="form.invoiceTel"
                      placeholder="请输入电话"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="开户账号" prop="invoiceBank">
                    <el-input
                      v-model="form.invoiceBank"
                      placeholder="请输入开户账号"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="发票接收地址" prop="invoiceBankAddress">
                    <el-input
                      v-model="form.invoiceBankAddress"
                      placeholder="请输入发票接收地址"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item> </el-form-item>
                </el-col>
              </el-row>
              <el-divider>邮寄信息</el-divider>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="收件人" prop="mailPerson">
                    <el-input
                      v-model="form.mailPerson"
                      placeholder="请输入收件人"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="4">
                  <el-form-item> </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="收件人电话" prop="mailTel">
                    <el-input
                      v-model="form.mailTel"
                      placeholder="请输入收件人电话"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="10">
                  <el-form-item label="收件地址" prop="mailAddress">
                    <el-input
                      v-model="form.mailAddress"
                      placeholder="请输入收件地址"
                    />
                  </el-form-item>
                </el-col>
                <el-col :span="14">
                  <el-form-item> </el-form-item>
                </el-col>
              </el-row>
              <!-- <el-form-item label="${comment}" prop="rejectCause">
              <el-input
                v-model="form.rejectCause"
                placeholder="请输入${comment}"
              />
            </el-form-item> -->
              <!-- <el-form-item label="排序字段" prop="sort">
              <el-input v-model="form.sort" placeholder="请输入排序字段" />
            </el-form-item> -->
            </el-form>
          </el-scrollbar>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitInfo">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
          </div>
        </el-dialog></el-tab-pane
      >
    </el-tabs>
  </div>
</template>

<script>
import {
  listJoin,
  getJoin,
  delJoin,
  addJoin,
  updateJoin,
  listShenHe,
  submit,
} from "@/api/game/join";
import { listTrain } from "@/api/page/train";
export default {
  name: "Join",
  data() {
    return {
      //培训列表
      trainList: [],
      // 遮罩层
      loading: true,
      loading2: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      total2: 0,
      // 培训报名表格数据
      joinList: [],
      shenheList: [],
      // 弹出层标题
      title: "",
      title2: "",
      // 是否显示弹出层
      open: false,
      open2: false,
      // 查询参数
      queryParams: {
        page: 1,
        rowsPerPage: 10,
        title: null,
        trainId: null,
        trainName: null,
        projectId: null,
        projectName: null,
        name: null,
        tel: null,
        idCard: null,
        unit: null,
        joinTime: null,
        roomType: null,
        entryCost: null,
        cost: null,
        invoiceTitle: null,
        invoiceTaxNumber: null,
        invoiceTel: null,
        invoiceBank: null,
        invoiceBankAddress: null,
        mailPerson: null,
        mailTel: null,
        mailAddress: null,
        status: null,
        rejectCause: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        sort: null,
      },
      queryPlayParams: {
        page: 1,
        rowsPerPage: 999,
      },
      // 表单参数
      form: {},
      form2: {},
      // 表单校验
      rules: {},
      submitForm: {
        id: null,
        rejectCause: null,
        result: null,
      },
    };
  },
  created() {
    this.getList();
    this.getTrainList();
    this.getShenHeList();
  },
  methods: {
    //清空搜索
    clearQuery(tab, event) {
      console.log(tab, event);
      this.resetQuery();
    },

    // 审核
    submitYes() {
      this.submitForm.result = "yes";
      submit(this.submitForm).then((res) => {
        if (res.code == 200) {
          this.getStatus(this.submitForm.id);
          this.$modal.msgSuccess("审核通过!");
        }
        this.getShenHeList();
      });
    },
    submitNo() {
      this.submitForm.result = "no";
      submit(this.submitForm).then((res) => {
        if (res.code == 200) {
          this.getStatus(this.submitForm.id);
          this.$modal.msgSuccess("已退回!");
        }
        this.getShenHeList();
      });
    },

    //获取状态
    getStatus(id) {
      getJoin(id).then((response) => {
        this.form2.status = response.data.status;
      });
    },

    // 获取培训列表
    getTrainList() {
      // this.loading = true;
      listTrain(this.queryPlayParams).then((response) => {
        this.trainList = response.data.list;
      });
    },

    // 获取审核列表
    getShenHeList() {
      this.loading2 = true;
      listShenHe(this.queryParams).then((response) => {
        this.shenheList = response.data.list;
        this.total2 = response.data.totalCount;
        this.loading2 = false;
      });
    },

    /** 查询培训报名列表 */
    getList() {
      this.loading = true;
      listJoin(this.queryParams).then((response) => {
        this.joinList = response.data.list;
        this.total = response.data.totalCount;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    cancel2() {
      this.open2 = false;
      this.reset2();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        title: null,
        trainId: null,
        trainName: null,
        projectId: null,
        projectName: null,
        name: null,
        tel: null,
        idCard: null,
        unit: null,
        joinTime: null,
        roomType: null,
        entryCost: null,
        cost: null,
        invoiceTitle: null,
        invoiceTaxNumber: null,
        invoiceTel: null,
        invoiceBank: null,
        invoiceBankAddress: null,
        mailPerson: null,
        mailTel: null,
        mailAddress: null,
        status: null,
        rejectCause: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        sort: null,
      };
      this.resetForm("form");
    },
    // 表单重置
    reset2() {
      this.form2 = {
        id: null,
        title: null,
        trainId: null,
        trainName: null,
        projectId: null,
        projectName: null,
        name: null,
        tel: null,
        idCard: null,
        unit: null,
        joinTime: null,
        roomType: null,
        entryCost: null,
        cost: null,
        invoiceTitle: null,
        invoiceTaxNumber: null,
        invoiceTel: null,
        invoiceBank: null,
        invoiceBankAddress: null,
        mailPerson: null,
        mailTel: null,
        mailAddress: null,
        status: null,
        rejectCause: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        sort: null,
      };
      this.submitForm = {
        id: null,
        rejectCause: null,
        result: null,
      };
      this.resetForm("form2");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.resetForm("queryForm2");
      (this.queryParams = {
        page: 1,
        rowsPerPage: 10,
        title: null,
        trainId: null,
        trainName: null,
        projectId: null,
        projectName: null,
        name: null,
        tel: null,
        idCard: null,
        unit: null,
        joinTime: null,
        roomType: null,
        entryCost: null,
        cost: null,
        invoiceTitle: null,
        invoiceTaxNumber: null,
        invoiceTel: null,
        invoiceBank: null,
        invoiceBankAddress: null,
        mailPerson: null,
        mailTel: null,
        mailAddress: null,
        status: null,
        rejectCause: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        sort: null,
      }),
        this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加培训报名";
    },

    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getJoin(id).then((response) => {
        this.form = response.data;
        this.open = true;
        this.title = "修改培训报名";
      });
    },

    // 审核修改
    shenhe(row) {
      this.reset2();
      const id = row.id || this.ids;
      this.submitForm.id = row.id;
      getJoin(id).then((response) => {
        this.form2 = response.data;
        this.open2 = true;
        this.title2 = "审核信息";
      });
    },

    /** 提交按钮 */
    submitInfo() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          if (this.form.id != null) {
            updateJoin(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addJoin(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },

    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除培训报名编号为"' + ids + '"的数据项？')
        .then(function () {
          return delJoin(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },

    /** 删除按钮操作 */
    handleDelete2(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除审核编号为"' + ids + '"的数据项？')
        .then(function () {
          return delJoin(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        "project/join/export",
        {
          ...this.queryParams,
        },
        `join_${new Date().getTime()}.xlsx`
      );
    },
    // 培训总表
    exportTotal() {
      if (!this.queryParams.trainId) {
        this.$modal.msgError("请先选择培训!");
      } else {
        this.downloadFile(
          "/work/train/exportJoinPerson",
          {
            trainId: this.queryParams.trainId,
          },
          `referee_${new Date().getTime()}.xlsx`
        );
      }
    },
    // 费用表
    exportReffers() {
      if (!this.queryParams.trainId) {
        this.$modal.msgError("请先选择培训!");
      } else {
        this.downloadFile(
          "/work/train/exportPayInfo",
          {
            trainId: this.queryParams.trainId,
          },
          `referee_${new Date().getTime()}.xlsx`
        );
      }
    },
  },
};
</script>
